package com.android.lgc.android_mvp.IPresenter;

import com.android.lgc.android_mvp.DataBack;
import com.android.lgc.android_mvp.IView.LoginView;
import com.android.lgc.android_mvp.IModel.LoginModel;
import com.android.lgc.android_mvp.base.BasePresenter;

/**
 * @author $
 * @fileName LoginPersenter
 * @date2021/3/8 14:47
 * @describe TODO
 * @desc P层
 * 特点一:持有M层的引用
 * 特点二:持有V层的引用
 * 特点三:对M层与V层进行关联
 */
public class LoginPersenter extends BasePresenter<LoginView> {

    private LoginModel mLoginModel;


    public LoginPersenter(){
        mLoginModel=new LoginModel();
    }

    public void login(String username,String password){
        this.mLoginModel.login(username, password, new DataBack() {
            @Override
            public void backData(String result) {
               if(getView()!=null){
                   getView().onLoginResult(result);
               }
            }
        });

    }
}
